<template>
  <view>
    <view class="header">
      <Navbar title="购物车" backgroundColor="transparent" color="#fff" :fixed="false" />
      <view class="container">
        <view class="content">
          <view class="statistics">
            <view class="yd-flex-h-hL-vC">
              <image class="checkbox" src="~@/static/shop/checkboxFalse.png" />
              <text class="statistics__text">购物车</text>
              <view class="statistics__tag">已选商品：1</view>
            </view>
            <view class="statistics__btn">清空</view>
          </view>
          <view v-for="(item, index) in goods" :key="index" class="goods">
            <image class="checkbox" src="~@/static/shop/checkboxFalse.png" />
            <image class="goods__img" :src="item.img" />
            <view class="goods__cont">
              <view class="goods__name">{{ item.name }}</view>
              <view @tap="car" class="goods__sku">
                <text>{{ item.sku }}</text>
                <image class="goods__arrow" src="~@/static/downArrow.png" />
              </view>
              <view class="goods__total">
                <text class="red">￥{{ item.price }}</text>
                <van-stepper />
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
    <view class="bottom-nav yd-flex-h-hS-vC">
      <view class="yd-flex-h-hL-vC">
        <text>合计：</text>
        <text class="red">￥49.00</text>
        <text class="nav__tip">(不含运费)</text>
      </view>
      <view class="nav__btn yd-flex-h-hC-vC">去结算</view>
    </view>
    <GoodsSku ref="GoodsSku" />
  </view>
</template>

<script>
import GoodsSku from '@/components/GoodsSku/GoodsSku.vue';

export default {
  components: { GoodsSku },
  data() {
    return {
      goods: [
        {
          img: 'https://img1.360buyimg.com/n6/jfs/t1/32679/33/20887/186750/640a81afF3ddd8f89/03e2d91c12c0c46a.jpg',
          name: '简朵 i5 10400F升八核/GTX1650 4G/16G内存游戏台式吃鸡电脑主机DIY组装机',
          sku: '白色，单主机',
          price: '1459.00'
        },
        {
          img: 'https://img11.360buyimg.com/n7/jfs/t1/146790/13/29242/146893/63f73476Fb2b1fd64/75e60aeeac6e8ce5.jpg',
          name: 'HW 12代酷睿i7十四核可选RTX3060吃鸡LOL海景房直播办公家用游戏电脑台式机主机整机组装机 主机+24英寸高清显示器 高配 i7十代/16G/512G/RX580游戏',
          sku: '黑色，主机+屏幕',
          price: '4958.00'
        },
      ]
    }
  },
  methods: {
    car() {
      this.$refs.GoodsSku.open();
    },
  }
}
</script>


<style>
.header {
  width: 100%;
  background-image: url('~@/static/index/bg.png');
  background-size: 100% 400rpx;
  background-repeat: no-repeat;
  overflow: hidden;
}
.header__box {
  box-sizing: border-box;
  padding: 0 24rpx;
}
.swiper {
  width: 100%;
  height: 288rpx;
  border-radius: 22rpx;
  overflow: hidden;
  margin-top: 24rpx;
  margin-bottom: 24rpx;
}
.swiper__item, .swiper__image {
  width: 100%;
  height: 100%;
}
/* 内容 */
.container {
  box-sizing: border-box;
  padding: 0 24rpx calc(24rpx + 96rpx) 24rpx;
}
.content {
  border-radius: 22rpx;
  overflow: hidden;
  background-color: #fff;
}
.statistics {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 90rpx;
  border-bottom: 2rpx solid #E4E4E4;
  box-sizing: border-box;
  padding: 0 24rpx;
}
.statistics__text {
  color: #333333;
  font-size: 34rpx;
}
.statistics__tag {
  background-color: #FBBF0D;
  color: #fff;
  height: 42rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 464rpx;
  font-size: 24rpx;
  line-height: 1;
  box-sizing: border-box;
  padding: 0 16rpx;
  margin-left: 20rpx;
}
.statistics__btn {
  background-color: #F5F6F7;
  color: #999;
  width: 88rpx;
  height: 42rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 464rpx;
  font-size: 24rpx;
  line-height: 1;
}
.goods {
  width: 100%;
  margin-top: 24rpx;
  display: flex;
  box-sizing: border-box;
  padding: 0 0 0 20rpx;
}
.goods .checkbox {
  margin-top: 60rpx;
}
.goods__img {
  width: 160rpx;
  height: 160rpx;
  margin-right: 20rpx;
}
.goods__cont {
  flex: 1;
  border-bottom: 2rpx solid #E4E4E4;
  box-sizing: border-box;
  padding: 0 24rpx 24rpx 0;
}
.goods:last-child .goods__cont {
  border-bottom: none;
}
.goods__name {
  color: #333333;
  font-size: 24rpx;
  margin-bottom: 24rpx;
  line-height: 1.5;
}
.goods__sku {
  max-width: 100%;
  width: 336rpx;
  height: 56rpx;
  background-color: #FAFAFA;
  color: #999;
  font-size: 24rpx;
  margin-bottom: 18rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding: 0 4rpx 0 12rpx;
  border-radius: 6rpx;
}
.goods__arrow {
  width: 48rpx;
  height: 48rpx;
  margin-left: 12rpx;
}
.goods__total {
  font-size: 26rpx;
  color: #333333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
/* 顶部栏 */
.bottom-nav {
  width: 100%;
  height: 96rpx;
  background-color: #fff;
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 2;
  box-sizing: border-box;
  padding: 0 24rpx;
  font-size: 28rpx;
  color: #333333;
}
.nav__tip {
  color: #999999;
  font-size: 24rpx;
  margin-left: 12rpx;
}
.nav__btn {
  width: 154rpx;
  height: 72rpx;
  background-color: #FBBF0D;
  border-radius: 44rpx;
  color: #fff;
  font-size: 30rpx;
  line-height: 1;
}
.red {
  color: #FF2323;
}
.checkbox {
  width: 32rpx;
  height: 32rpx;
  margin-right: 20rpx;
}
</style>
